from selenium.webdriver.common.by import By
from page.base_page_helin import BasePage

class AddemailPage(BasePage):
    mbmc_locator = (By.NAME, "subject")
    yjzt_locator = (By.NAME, "title")
    yjnr_locator = (By.ID, "content")
    bc_locator = (By.CSS_SELECTOR, "input[value=保存]")

    gd_locator=(By.LINK_TEXT,"更多")
    yx_locator=(By.LINK_TEXT,"营销")
    fsyj_locator=(By.LINK_TEXT,"发送邮件")
    sz_locator=(By.XPATH,"/html/body/div[5]/div[2]/div[2]/form/div/div[2]/p/a[2]")
    tjyjmb_locator=(By.ID,"add")

    # 进入添加邮件模板页面，依次点击【更多】 【营销】【发送邮件】【设置】【添加邮件模板】
    def addemail_more(self):
        self.driver.find_element(*self.gd_locator).click()

    def addemail_sale(self):
        self.driver.find_element(*self.yx_locator).click()

    def addemail_sendemail(self):
        self.driver.find_element(*self.fsyj_locator).click()

    def addemail_setup(self):
        self.driver.find_element(*self.sz_locator).click()

    def addemail_addmodel(self):
        self.driver.find_element(*self.tjyjmb_locator).click()

    # 添加邮件模板
    def addemail_mbmc(self,mbmc):
       self.driver.find_element(*self.mbmc_locator).send_keys(mbmc)

    def addemail_yjzt(self, yjzt):
       self.driver.find_element(*self.yjzt_locator).send_keys(yjzt)

    def addemail_yjnr(self, yjnr):
       self.driver.find_element(*self.yjnr_locator).send_keys(yjnr)

    def addemail_bc(self):
       self.driver.find_element(*self.bc_locator).click()